/*
 * @Description: SyncBailHook 遇到有返回值时, 那么回掉函数将不会往下执行
 * @Author: wangqi
 * @Date: 2021-04-17 11:59:14
 * @LastEditTime: 2021-04-17 19:52:59
 */

// 同步保险函数
let { SyncBailHook } = require('tapable');

class Lesson {
    constructor() {
        this.hook = {
            arch: new SyncBailHook(['name', 'age']),
        }
    }

    tap() {
        this.hook.arch.tap('node', (...res) => {
            console.log("node", ...res);
            return '不往下执行了'
        });

        this.hook.arch.tap('vue', (...res) => {
            console.log("vue", ...res);
            return ''
        });
        this.hook.arch.tap('react', (...res) => {
            console.log("react", ...res);
        });
    }

    start() {
        this.hook.arch.call('wq', '12')
    }
}

let lesson = new Lesson();

lesson.tap();
lesson.start();
